"""add entity_id to products

Revision ID: a1b2c3d4e5f6
Revises: e394600e3a87
Create Date: 2025-08-25 00:00:00.000000
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = 'a1b2c3d4e5f6'
down_revision = 'e394600e3a87'
branch_labels = None
depends_on = None

def upgrade():
    op.add_column('products', sa.Column('entity_id', sa.String(length=255), nullable=True, comment='图片实体ID'))
    op.create_index(op.f('ix_products_entity_id'), 'products', ['entity_id'], unique=False)

def downgrade():
    op.drop_index(op.f('ix_products_entity_id'), table_name='products')
    op.drop_column('products', 'entity_id')